﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BrokerBase.Lib.Policy;

namespace broker.duty.ZY
{
    /// <summary>
    /// 生命附加豁免保险费定期寿险
    /// </summary>
    class Class7
    {
        /// <summary>
        /// 身故豁免保险费
        /// </summary>
        /// <param name="ppa"></param>
        /// <param name="da"></param>
        public void Calc1(IPolicyPeriodActing ppa, IDutyActing da)
        {
            if (ppa.Period >0 && ppa.PolicyActing.PeriodActings[ppa.Period-1].SchemePeriodActing.HolderStates.Contains("身故"))
            {
                foreach (IPolicyPeriodActing p2 in ppa.PolicyActing.PeriodActings[ppa.Period - 1].SchemePeriodActing.PolicyPeriodActings)
                {
                    p2.Fee = 0;
                }

                ppa.IsCurrentFinish = true;
            }
        }
        /// <summary>
        /// 全残豁免保险费
        /// </summary>
        /// <param name="ppa"></param>
        /// <param name="da"></param>
        public void Calc1(IPolicyPeriodActing ppa, IDutyActing da)
        {
            if (ppa.Period > 0 && ppa.PolicyActing.PeriodActings[ppa.Period - 1].SchemePeriodActing.HolderStates.Contains("身故"))
            {
                foreach (IPolicyPeriodActing p2 in ppa.SchemePeriodActing.PolicyPeriodActings)
                {
                    p2.Fee = 0;
                }

                ppa.IsCurrentFinish = true;
            }
        }

        public void Calc1(IPolicyPeriodActing ppa, IDutyActing da)
        {
            if (ppa.SchemePeriodActing.InsurantStates.Contains("疾病重疾"))
            {
                if (ppa.Period == 0)
                {
                    da.Value = ppa.TotalFee;
                }
                else
                {
                    da.Value = ppa.Amount;
                }

                ppa.SchemePeriodActing.InsurantStates.Add("重疾");
                ppa.IsCurrentFinish = true;

            }
            else if (ppa.SchemePeriodActing.InsurantStates.Contains("意外重疾"))
            {
                da.Value = ppa.Amount;
                ppa.SchemePeriodActing.InsurantStates.Add("重疾");
                ppa.IsCurrentFinish = true;
            }

        }

        public void Calc1(IPolicyPeriodActing ppa, IDutyActing da)
        {
            if (ppa.SchemePeriodActing.InsurantStates.Contains("疾病轻症疾病"))
            {
                if (ppa.Period == 0)
                {
                    da.Value = ppa.TotalFee;
                }
                else
                {
                    da.Value = ppa.Amount * 0.2;
                }

                ppa.SchemePeriodActing.InsurantStates.Add("轻症疾病");


            }
            else if (ppa.SchemePeriodActing.InsurantStates.Contains("疾病轻症疾病"))
            {
                da.Value = ppa.Amount * 0.2;
                ppa.SchemePeriodActing.InsurantStates.Add("轻症疾病");

            }

        }
    }
}
